package org.tobuy.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.tobuy.vo.*;
import org.tobuy.factory.*;

public class ShowAuctionDetail extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String path = "index.jsp?action=showAuctionDetail";
		String item_id = request.getParameter("item_id");
		Auction auction = new Auction();
		Item item = new Item();
		try {
			auction = AuctionDAOFactory.getIAuctionDAOInstance().findAuction(item_id);
			item = ItemDAOFactory.getIItemDAOInstance().findItem(item_id);
		} catch (Exception e) {
			e.printStackTrace();
		}
		request.setAttribute("auction", auction);
		request.setAttribute("item", item);
		request.getRequestDispatcher(path).forward(request, response);

	
	}


	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doGet(request, response);
	
	}

}
